home *** CD-ROM | disk | FTP | other *** search
- package com.sun.java.swing.plaf.metal;
-
- import com.sun.java.swing.AbstractButton;
- import com.sun.java.swing.ButtonModel;
- import com.sun.java.swing.Icon;
- import com.sun.java.swing.JMenu;
- import com.sun.java.swing.JMenuItem;
- import com.sun.java.swing.plaf.UIResource;
- import java.awt.Component;
- import java.awt.Graphics;
- import java.io.Serializable;
-
- class MetalIconFactory$RadioButtonMenuItemIcon implements Icon, UIResource, Serializable {
- public void paintIcon(Component c, Graphics g, int x, int y) {
- JMenuItem b = (JMenuItem)c;
- ButtonModel model = ((AbstractButton)b).getModel();
- boolean isSelected = model.isSelected();
- boolean isEnabled = model.isEnabled();
- boolean isPressed = model.isPressed();
- boolean isArmed = model.isArmed();
- g.translate(x + 4, y);
- if (isEnabled) {
- if (!isPressed && !isArmed) {
- g.setColor(MetalLookAndFeel.getControlHighlight());
- g.drawLine(3, 1, 8, 1);
- g.drawLine(2, 9, 7, 9);
- g.drawLine(1, 3, 1, 8);
- g.drawLine(9, 2, 9, 7);
- g.drawLine(2, 2, 2, 2);
- g.drawLine(8, 8, 8, 8);
- g.setColor(MetalLookAndFeel.getControlDarkShadow());
- g.drawLine(2, 0, 6, 0);
- g.drawLine(2, 8, 6, 8);
- g.drawLine(0, 2, 0, 6);
- g.drawLine(8, 2, 8, 6);
- g.drawLine(1, 1, 1, 1);
- g.drawLine(7, 1, 7, 1);
- g.drawLine(1, 7, 1, 7);
- g.drawLine(7, 7, 7, 7);
- } else {
- g.setColor(MetalLookAndFeel.getPrimaryControl());
- g.drawLine(3, 1, 8, 1);
- g.drawLine(2, 9, 7, 9);
- g.drawLine(1, 3, 1, 8);
- g.drawLine(9, 2, 9, 7);
- g.drawLine(2, 2, 2, 2);
- g.drawLine(8, 8, 8, 8);
- g.setColor(MetalLookAndFeel.getControlInfo());
- g.drawLine(2, 0, 6, 0);
- g.drawLine(2, 8, 6, 8);
- g.drawLine(0, 2, 0, 6);
- g.drawLine(8, 2, 8, 6);
- g.drawLine(1, 1, 1, 1);
- g.drawLine(7, 1, 7, 1);
- g.drawLine(1, 7, 1, 7);
- g.drawLine(7, 7, 7, 7);
- }
- } else {
- g.setColor(MetalLookAndFeel.getMenuDisabledForeground());
- g.drawLine(2, 0, 6, 0);
- g.drawLine(2, 8, 6, 8);
- g.drawLine(0, 2, 0, 6);
- g.drawLine(8, 2, 8, 6);
- g.drawLine(1, 1, 1, 1);
- g.drawLine(7, 1, 7, 1);
- g.drawLine(1, 7, 1, 7);
- g.drawLine(7, 7, 7, 7);
- }
-
- if (isSelected) {
- if (!isEnabled) {
- g.setColor(MetalLookAndFeel.getMenuDisabledForeground());
- } else if (!model.isArmed() && (!(c instanceof JMenu) || !model.isSelected())) {
- g.setColor(((Component)b).getForeground());
- } else {
- g.setColor(MetalLookAndFeel.getMenuSelectedForeground());
- }
-
- g.drawLine(3, 2, 5, 2);
- g.drawLine(2, 3, 6, 3);
- g.drawLine(2, 4, 6, 4);
- g.drawLine(2, 5, 6, 5);
- g.drawLine(3, 6, 5, 6);
- }
-
- g.translate(-(x + 4), -y);
- }
-
- public int getIconWidth() {
- return MetalIconFactory.access$menuCheckIconSize().width;
- }
-
- public int getIconHeight() {
- return MetalIconFactory.access$menuCheckIconSize().height;
- }
- }
-